package unimelb.discussiontracker.twitter.data.entity;

import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "Topic")
@NamedQueries(value = { @NamedQuery(name = "Topic.FindAll", query = "SELECT topic FROM TopicEntity topic ORDER BY topic.text ASC"),
        @NamedQuery(name = "Topic.FindByName", query = "SELECT topic FROM TopicEntity topic WHERE topic.text = :topicText") })
public class TopicEntity {
    @Id
    @GeneratedValue
    @Column(name = "Id")
    private long id;

    @Column(name = "Text")
    private String text;

    @OneToMany(mappedBy = "topic")
    private Set<TopicIntervalAssociation> associatedIntervals;

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public Set<TopicIntervalAssociation> getAssociatedIntervals() {
        return associatedIntervals;
    }

    public void setAssociatedIntervals(Set<TopicIntervalAssociation> associatedIntervals) {
        this.associatedIntervals = associatedIntervals;
    }

}
